import Vue from 'vue'
import Router from 'vue-router'
import MainRising from '@/views/MainRising'
import MainUnload from '@/views/MainUnload'
import DuringUp from '@/views/DuringUp'
import RowWater from '@/views/RowWater'
import TheBelt from '@/views/TheBelt'
import VentiLation from '@/views/VentiLation'
import DownAir from '@/views/DownAir'
import ThePower from '@/views/ThePower'
import TheHot from '@/views/TheHot'
import OverView from '@/views/OverView'
import TopoEdit from '@/views/TopoEdit'
import TopoView from '@/views/TopoView'

Vue.use(Router)
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err)
}

export default new Router({
  mode: 'history',
  routes: [
    {path: '/', redirect: '/overview'},
    {
      path: '/overview',
      name: '煤矿自动化系统',
      component: OverView
    },
    {
      path: '/mainrising',
      name: '主井提升系统',
      component: MainRising
    },
    {
      path: '/mainunload',
      name: '主井装卸系统',
      component: MainUnload
    },
    {
      path: '/duringup',
      name: '副井提升系统',
      component: DuringUp
    },
    {
      path: '/rowwater',
      name: '排水系统',
      component: RowWater
    },
    {
      path: '/thebelt',
      name: '皮带系统',
      component: TheBelt
    },
    {
      path: '/ventilation',
      name: '通风系统',
      component: VentiLation
    },
    {
      path: '/downair',
      name: '压风系统',
      component: DownAir
    },
    {
      path: '/thehot',
      name: '余热利用系统',
      component: TheHot
    },
    {
      path: '/thepower',
      name: '电力系统',
      component: ThePower
    },
    {
      path: '/topoedit',
      name: '电力组态编辑',
      component: TopoEdit,
      meta: {
        keepAlive: true // 需要缓存
      }
    },
    {
      path: '/topoview',
      name: '组态预览',
      component: TopoView
    }
  ]
})
